public class InterfaceDemo09 {
    public static void main(String[] args) {
        Gun gun = new Gun("ak47");
        gun.fly();
        gun.killPerson();

    }
}


abstract class Weapon {
    private String name;

    public Weapon(String name) {
        this.name = name;
    }

    // 抽象方法
    public abstract void killPerson();
}


interface IFly {
    void fly();
}

// 枪类
class Gun extends Weapon implements IFly {

    public Gun(String name) {
        super(name);
    }

    @Override
    public void killPerson() {
        System.out.println("用子弹杀人");
    }

    @Override
    public void fly() {
        System.out.println("手枪会飞");
    }
}

class Tank extends Weapon implements IFly {

    public Tank(String name) {
        super(name);
    }

    @Override
    public void killPerson() {
        System.out.println("用炮弹杀人");
    }

    @Override
    public void fly() {
        System.out.println("坦克会飞");
    }
}
